package com.yupi.springbootinit.model.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

@Getter
@RequiredArgsConstructor
public enum ScoringStrategyEnum {
    CUSTOM(0, "自定义"),
    AI(1, "AI");

    private final Integer code;
    private final String description;

    public static ScoringStrategyEnum fromCode(Integer code) {
        if (code == null) return null;
        return Arrays.stream(values())
                .filter(strategy -> strategy.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }
}